package cn.mdmm.web.context;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.ContextLoaderListener;

import cn.modoumama.common.utils.ConfigProperty;


/**
 * 系统启动时加载配置文件
 * @version 1.0
 */
public class DbContextLoaderListener extends ContextLoaderListener implements ServletContextListener {


	protected static final Logger logger = LoggerFactory.getLogger(DbContextLoaderListener.class);
	
	@Override
	public void contextDestroyed(ServletContextEvent event) { 
		super.contextDestroyed(event);
	}
	 
	@Override
	public void contextInitialized(ServletContextEvent event) {
		super.contextInitialized(event);
		
		ServletContext servletContext = event.getServletContext();
		servletContext.setAttribute("version", ConfigProperty.getProperty("version"));
		servletContext.setAttribute("initPassword", ConfigProperty.getProperty("default.password"));
	}
	
}
